#ifndef ITEM_TYPE_HPP_INCLUDED
#define ITEM_TYPE_HPP_INCLUDED

#include <boost/shared_ptr.hpp>

#include <string>

#include "formula.hpp"
#include "wml_node_fwd.hpp"

class item_type;
typedef boost::shared_ptr<item_type> item_type_ptr;
typedef boost::shared_ptr<const item_type> const_item_type_ptr;

class item_type
{
public:
	static void init(wml::const_node_ptr node);
	static const_item_type_ptr get(const std::string& key);

	explicit item_type(wml::const_node_ptr node);

	const std::string& id() const { return id_; }
	bool spoils(bool used) const;
	bool spoilable() const;

	const std::string& downgrades_to() const { return downgrades_to_; }
	const std::string& upgrades_to() const { return upgrades_to_; }
	const std::string& combines_with() const { return combines_with_; }
private:
	std::string id_;
	game_logic::const_formula_ptr spoil_formula_;
	std::string downgrades_to_;
	std::string upgrades_to_;
	std::string combines_with_;
};

#endif
